package com.example.qinghe.service.sale;

import com.example.qinghe.dao.sale.OpportunityqhMapper;
import com.example.qinghe.entity.Page;
import com.example.qinghe.entity.sale.Opportunityqh;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OpportunityqhService {

    @Autowired
    private OpportunityqhMapper dao;

    public List<Opportunityqh> selectOpportunityqhList(Page page, @Param("pagestart") int pagestart, @Param("limit") int limit,@Param("opportunityname")String opportunityname, @Param("companyname")String companyname){
        return dao.selectOpportunityqhList((page.getPage() - 1) * page.getLimit(), page.getLimit(),opportunityname,companyname);
    }



    public int countTotall(@Param("opportunityname")String opportunityname, @Param("companyname")String companyname)
    {
        return dao.countTotall(opportunityname,companyname);
    }


    // 根据商机id查找具体商机信息
    public Opportunityqh selectOpportunityqhById(Long id){
        return dao.selectOpportunityqhById(id);
    }


    // 根据员工id查找员工的所有商机,查找当前员工的所有商机
    public List<Opportunityqh> selectOpportunityqhByStaffId(Long id){
        return dao.selectOpportunityqhByStaffId(id);
    }

}
